package a08_StringDemo;

/**
 * @Author quan
 * @Description 字符串的反转
 * @Date 2023/1/29 23:51
 */
public class StrReverse {
    public static void main(String[] args) {
        String result = reverse("abcdefg");
        System.out.println(result);
    }
    //定义反转的方法
    public static String reverse(String str){
        String result = "";
        for (int i = str.length()-1; i >=0 ; i--) {
            char c = str.charAt(i);
            result = result+c;
        }
        return result;
    }
}
